package com.haoyun.mirage.auth.client;

import com.haoyun.mirage.auth.client.fallback.UserServiceClientFallBack;
import com.haoyun.common.core.Result;
import com.haoyun.mirage.auth.vo.UserVO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * Created by twg on 2018/3/8.
 * fallback 服务降级实现类
 */
@FeignClient(name = "userservice-v1",fallback = UserServiceClientFallBack.class)
public interface UserServiceClient {

    @PostMapping(value = "/user/createUser",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Result<String> createUser(@RequestBody UserVO user);

    @GetMapping("/user/getUserByName/{username}")
    UserVO getUserByName(@PathVariable("username") String username);

    @GetMapping("/user/getUserRolesByName/{username}")
    UserVO getUserRolesByName(@PathVariable("username") String username);
}
